package entity

// HistoryMsg 历史消息
type HistoryMsg struct {
	Terminal     string            `json:"terminal"` // 终端
	Holomongomsg HistoryMsgContent `json:"holomongomsg"`
	Content      string            `json:"content"`     // 消息内容
	UserInfo     HistoryMsgUser    `json:"userInfo"`    // 用户信息
	OriginalUrl  string            `json:"originalUrl"` // 图片/ 原图url
	ThumbUrl     string            `json:"thumbUrl"`    // 图片/ 缩略图url
	VideoUrl     string            `json:"videoUrl"`    // 视频url
}

type HistoryMsgContent struct {
	SenderId         int    `json:"senderId,string"`
	TargetId         int    `json:"targetId,string"`
	ConversationType int    `json:"conversationType,string"`
	MessageType      int    `json:"messageType,string"`
	MessageId        string `json:"messageId"`
	SentTime         int    `json:"sentTime"`
	Extra            string `json:"extra"`
}

type HistoryMsgUser struct {
	Id          int    `json:"id,string"`
	Username    string `json:"username"`
	PortraitUrl string `json:"portraitUrl"`
}

const (
	MESSAGE_TYPE_TEXT   = 1
	MESSAGE_TYPE_PIC    = 2
	MESSAGE_TYPE_VOICE  = 3
	MESSAGE_TYPE_VIDEO  = 4
	MESSAGE_TYPE_MIXED  = 5
	MESSAGE_TYPE_CUSTOM = 6
)

func ParseObjectName(messageType int) string {
	switch messageType {
	case MESSAGE_TYPE_PIC:
		return "HV:ImageMessage"
	case MESSAGE_TYPE_VOICE:
		return "HV:VoiceMessage"
	case MESSAGE_TYPE_VIDEO:
		return "HV:VideoMessage"
	default:
		// case MESSAGE_TYPE_CUSTOM:
		// case MESSAGE_TYPE_MIXED:
		// case MESSAGE_TYPE_TEXT:
		return "HV:TextMessage"
	}
}
